/**
 * @author: wq
 * @Date: 2017/7/8
 * @Time: 16:12
 * <p>
 * Description:
 *          ***
 */
import axios from 'axios';
import { API_NEW_VERSION } from '../api';
var qs = require('qs');
const TRANSIT_SELF_EXTRACTS = API_NEW_VERSION + 'transit/self_extracts';
const TRANSIT_SELF_EXTRACT = API_NEW_VERSION + 'transit/self_extract/';
/**
 * 保存到达自提
 * @param params
 * @returns {AxiosPromise}
 */
export const save = (id, params) => {
  return axios.post(API_NEW_VERSION + 'transit/' + id + '/self_extracts', params);
};

/**
 * 获取到达自提
 * @param params
 * @returns {AxiosPromise}
 */
export const search = params => {
  return axios.get(TRANSIT_SELF_EXTRACTS, {params: params});
};

/**
 * 删除到达自提
 * @param params
 * @returns {AxiosPromise}
 */
export const deleteSelfExtracts = ids => {
  return axios.delete(TRANSIT_SELF_EXTRACT + ids);
};

// 获取订单id对应的自提信息
export const getSelfEctractByOrderId = id => {
  return axios.get(API_NEW_VERSION + 'transit/self_extract_by_orderid?id=' + id);
};

// 添加图片
export const saveSelfTractPictures = (id, fileList) => {
  return axios.post(API_NEW_VERSION + 'transit/self_extract_by_orderid_addimg', qs.stringify({id: id, fileList: fileList}));
};
